#!/usr/local/bin/python3
# -*- coding: UTF-8 -*-
"""
@author:apple
@file:demo03.py
@time:2021/07/20
"""
import builtins

def test01():
    ...
    try:
        ...
        in_result = input('请输入:')
        in_result = int(in_result)
    except Exception as e:
        ...
        print("请输入数字")
    else:
        ...
        print(in_result)


def intersect(n, m):
    ...
    # res = []
    # for i in n:
    #     if i in m:
    #         res.append(i)
    # return res
    return [i for i in n if i in m]

class Person:
    ...

    def __init__(self):
        self.name = 'zhangsan'
        self.age = 21

    # def __dir__(self):
    #
    #     return ['111']


def run(name):
    ...
    print(name)

if __name__ == '__main__':
    pass
    # test01()
    # test01.name = 1
    # print(test01.name)
    print(intersect([1, 2], (3, 2)))
    # print(dir(builtins))
    """
    dir(p_object=None) 函数
        1. 如果 p_object == None ,则获取命名空间的属性的key
        2. 如果 p_object != None
            2.1 如果 p_object 有 属性 __dir__(), 则返回 __dir__ 函数的返回值
            2.2 如果 p_object 为 模块，则返回 模块里面的属性 key
            2.3 如果 p_object 为 对象，则返回对象的 attributes 属性的 key
            
    """
    # for k in dir(builtins):
    #     print(k)
    print(dir())
    per = Person()
    print(dir(per))
    print(per.__dict__)